var req;

function AjaxObjectCreate()
{
	if (window.XMLHttpRequest) {
        req = new XMLHttpRequest;
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
    }
	return req;
}
/*function for forgotpassword starts*/
/* for forgot pass */

function submit_form1()
{
	var getString=j('#Username').val();

	generalSubmit("forgotadminpass_process.php?action=forgotPass&Username=" + getString);
}

function generalSubmit(url) 
{
		var params='';
		
		j.ajax({

				type: "POST",

				url: url,

				data: params,

				dataType: 'text',
				
				success: function(data){
				
				var msg_no=trim(data).substring(0,1);

				var msg_test=trim(data).substr(2);
			
				if(msg_no == 2)
				{
					j('#myResponse').html('');
					j('#myResponse').html(msg_test);
				}
				}
		});

}
/*function for forgotpassword ends*/
/* Get Login Starts */

function ChangeOrderStatus2(OrderDetailsID)
{	
	
	//var fieldID = 'resume';
	//var inputs = jQuery('#newsform').children().find('input');
	
	
	j.ajax({
				data:		{
					
					ChangeOrderStatusID:j('#ChangeOrderStatusID').val(),
					shipAmount:'0',
					OrderDetailsID: OrderDetailsID,
					action:		'save'
				},
				url:		'order_status_process.php',
				type:		'post',
				dataType:   'json',
				success:	function(response){
					if (response.flag)
					{
						
							j('#TransMsgDisplay').html(response.mess);
							j('#contact_form').slideUp("slow" , function(){
							
							var inputs = j('#form_car').find('.car_req');
							j(inputs).val('');
							j(jQuery('#contact_form').find('form')[0]).hide();
							j('#ccontact_form').slideDown("slow");
						});
						
					}
				}
	});
}




function GetLogin(formID)

{
	var email = j('#Username').val();
	var password = j('#Password').val();

	//var j = jQuery.noConflict(); 

	var retval1 = CheckEmpty('myusername','Username','Username');

	var retval2 = CheckEmpty('mypassword','Password','Password');

	
	var frmID='#'+formID;
	
			var params ={

				'module': 'contact',

				'action': 'sendContactData'

			};

			var paramsObj = j(frmID).serializeArray();

			
			j.each(paramsObj, function(i, field){

				params[field.name] = field.value;

			});


		if(retval1 && retval2)
		{
			j.ajax({

				type: "POST",

				url: 'adminlogin.php',

				data: params,

				dataType: 'json',
				
				success: function(data){
				
					
					if (data.flag == 1)
					{						
						//j.post("../forum/ucp.php?mode=login&main_site=true",{"username":email,"password":password,"redirect":"","login":"Log in"}, function(data){
							window.location.href="home.php";
						//});
					}
					else
					{
						j('#TransMsgDisplay').html('Authentication failed');
					}

				}

		});
		}
	
}

function processGetLogin(originalRequest)
{
	var responseTextTrim=trim(originalRequest.responseText);

      //alert(responseTextTrim);	

	if(responseTextTrim == 3)
	{
		window.location.href="home.php";
	}
	else
	{
		$('TransMsgDisplay').innerHTML=responseTextTrim;		
	}

 }

 /* Get Login Ends */

 

/* Get Update Starts */

function GetUpdate(formid,loginUrl)
{
	var username = j('#admin_username').val();
	var email = j('#sub_admin_email').val();
	var password = j('#admin_password').val();
	
	var frmID='#'+formid;
	
			var params ={
				'Submit3': 'Update'
			};

			var paramsObj = j(frmID).serializeArray();
			
			j.each(paramsObj, function(i, field){

				params[field.name] = field.value;

			});

		j('#myResponse').html('<img src="images/indicator.gif">');
	
		j.ajax({

				type: "POST",

				url: loginUrl,

				data: params,

				dataType: 'text',
				
				success: function(data){
				
					
					var x=trim(data);
				
					var temText1=trim(x).substr(0,1);    
				
					var temText2=trim(x).substr(2);    
				
					if(temText1=="2")
					{
						j.post("../forum/ucp.php?i=profile&mode=reg_details&main_site=true",{"username":username,"email_confirm":email,"email":email,"new_password":password,"password_confirm":password,"cur_password":j('#cur_password').val(),"redirect":"","submit":"Submit"}, function(data){																																																																							
						j('#myResponse').html(temText2);
						});
						
					}
				}
		});

}


function processGetUpdate(originalRequest)
{    

    var x=trim(originalRequest.responseText);

    var temText1=trim(x).substr(0,1);    

    var temText2=trim(x).substr(2);    

    if(temText1=="2")

    {
        $('myResponse').innerHTML=temText2;
	}

}

/* Get Update Ends */


 /* Change Order Status Starts */

function ChangeOrderStatus(formid)

{			

	var url="order_details_process.php";

    var pars=Form.serialize(formid); 

	var myAjax = new Ajax.Request(

	url,

	{
		method: 'post',

		parameters: pars,

		onComplete: processChangeOrderStatus

	});
}


function processChangeOrderStatus(originalRequest) 
{	

	var x=trim(originalRequest.responseText);

	var totmsqarr= x.split('||');

	$('TransMsgDisplay').innerHTML = "";

    $('TransMsgDisplay').innerHTML = totmsqarr[0];	

	if(totmsqarr[1] !="")
	{
		$('ShippingAmountId').innerHTML = "";
	
		$('ShippingAmountId').innerHTML = totmsqarr[1]+'&nbsp;&nbsp;';
	}

}

 /* Change Order Status Ends */


function GetPdfList(admId,cus_id) 
{	
    var url="showpdflist.php?admId="+admId+'&cusId='+cus_id;

    var pars=admId; 

	var myAjax = new Ajax.Request(

	url,
	{
		method: 'post',

		parameters: pars,

		onComplete: DisplayPdfProcess

	});			

}



function DisplayPdfProcess(originalRequest) 
{
	document.getElementById('PdfBox').innerHTML = "";

	document.getElementById('PdfBox').innerHTML = originalRequest.responseText;	
}


function GetCustomerList(admId,pdf_id) 
{	

    var url="showcustlist.php?admId="+admId+'&pdfId='+pdf_id;

    var pars=admId; 

	var myAjax = new Ajax.Request(

	url,
	{
		method: 'post',

		parameters: pars,

		onComplete: DisplayCustomerProcess
	});

}



function DisplayCustomerProcess(originalRequest) 
{	
	document.getElementById('UserBox').innerHTML = "";

	document.getElementById('UserBox').innerHTML = originalRequest.responseText;	
}


/* for forgot pass */

function submit_form()
{
	var getString=j('#Username').val();

	generalSubmit("forgotadminpass_process.php?action=forgotPass&Username=" + getString);
}

function generalSubmit(url) 
{

		var params='';

		
		j.ajax({

				type: "POST",

				url: url,

				data: params,

				dataType: 'text',
				
				success: function(data){
					
				var msg_no=trim(data).substring(0,1);

				var msg_test=trim(data).substr(2);
		
				if(msg_no == 2)
				{
					j('#myResponse').html('');
					j('#myResponse').html(msg_test);
				}
				}

		});

}


function processGeneral() 
{
      if(req1.readyState == 4) 
	   {
           if(req1.status == 200) 
		   {	

				var msg_no=trim(req1.responseText).substring(0,1);

				var msg_test=trim(req1.responseText).substr(2);

				if(msg_no == 2)
				{
					$('myResponse').innerHTML="";

					$('myResponse').innerHTML=msg_test;
				}

           } 

      }

 }


<!-- Seminar Type Ajax-->


<!--  Service Ajax Function Start  -->

function change_status(service_link_id,service_id,status)
{
			var params ={

				'service_link_id': service_link_id,

				'service_id': service_id,
				
				'ajax': 'Y',	
				
				'status': status,
				
				'action': 'activate_link'				

			};


		j.ajax({

				type: "POST",

				url: 'service_link.php',

				data: params,

				dataType: 'text',
				
				success: function(data){
				
						 	document.getElementById('link_list').innerHTML=data;				 
						//j('#DisplayLinkBlock').html(data);
					 
				}

		});

	
}

function delete_link_grp(service_group_id,service_id)

{


		if(confirm('Want To delete This Group?'))
		{
			var params ={

				'service_group_id': service_group_id,
				
				'service_id': service_id,
				
				'ajax': 'Y',
				
				'action': 'delete_link_grp'			

			};


		j.ajax({

				type: "POST",

				url: 'service_link.php',

				data: params,

				dataType: 'text',
				
				success: function(data){
				
						 	document.getElementById('link_list').innerHTML=data;
				}

		});
		}
}


function del_link(service_link_id,service_id,status)

{
		if(confirm('Want To delete?'))
		{
			var params ={

				'service_link_id': service_link_id,

				'service_id': service_id,
				
				'ajax': 'Y',	
				
				'status': status,
				
				'action': 'delete_link'			

			};


		j.ajax({

				type: "POST",

				url: 'service_link.php',

				data: params,

				dataType: 'text',
				
				success: function(data){
				
					document.getElementById('link_list').innerHTML=data;
				}

		});
		}
	
}

function change_type(service_link_id,service_id,service_link_open_type)

{
			var params ={

				'service_link_id': service_link_id,

				'service_id': service_id,
				
				'service_link_open_type': service_link_open_type,
				
				'ajax': 'Y',	
		
				'action': 'change_type'			

			};


		j.ajax({

				type: "POST",

				url: 'service_link.php',

				data: params,

				dataType: 'text',
				
				success: function(data){
					
					document.getElementById('link_list').innerHTML=data;
				}
		});
}


function create_link(service_group_id,service_id,div_id,link_count)
{
			var params ={

				'service_group_id': service_group_id,

				'service_id': service_id,
				
				'link_count': link_count,
				
				'action': 'change_type'		

			};


		j.ajax({

				type: "POST",

				url: 'create_service_link.php',

				data: params,

				dataType: 'text',
				
				success: function(data){
				
						 	document.getElementById(div_id).innerHTML=data;	
				}

		});

	
}


function insert_link(service_group_id,service_id,link_count)
{
			params ={

				'service_group_id': service_group_id,

				'service_id': service_id,
				
				'link_count': link_count,
				
				'ajax': 'Y',	
				
				'action': 'insert_link'			

			};



		var frmID='#link_frm_'+service_group_id;

		var paramsObj = j(frmID).serializeArray();

			
			j.each(paramsObj, function(i, field){

				params[field.name] = field.value;

			});			



		j.ajax({

				type: "POST",

				url: 'service_link.php',

				data: params,

				dataType: 'text',
				
				success: function(data){
			
						 	document.getElementById('link_list').innerHTML=data;				 
						
				}

		});

	
}

function create_grp_link(service_id,link_count,grp_title)
{
			var params ={

				'service_id': service_id,
				
				'link_count': link_count,
				
				'grp_title': grp_title,
		
				'action': 'create_grp_link'		

			};


		j.ajax({

				type: "POST",

				url: 'create_service_grp_link.php',

				data: params,

				dataType: 'text',
				
				success: function(data){
				
						 	document.getElementById('new_link_grp_div').innerHTML=data;				 
						
				}

		});

	
}

function insert_grp_link(service_id,link_count,grp_title)

{	
		if(grp_title!='')	
		{
			
			params ={

				'service_id': service_id,
				
				'link_count': link_count,
				
				'grp_title': grp_title,			
				
				'ajax': 'Y',	
				
				'action': 'insert_grp_link'				

			};


		var frmID='#grp_link_frm';

		var paramsObj = j(frmID).serializeArray();

			
			j.each(paramsObj, function(i, field){

				params[field.name] = field.value;

			});	


		j.ajax({

				type: "POST",

				url: 'service_link.php',

				data: params,

				dataType: 'text',
				
				success: function(data){
				
						 	document.getElementById('link_list').innerHTML=data;				 
						
				}

		});
		
		
		}

	
}

<!--  Service Ajax Function End  -->

<!--  Team Ajax Function Start  -->

function change_status_team(team_link_id,team_id,status)

{



			var params ={

				'team_link_id': team_link_id,

				'team_id': team_id,
				
				'ajax': 'Y',	
				
				'status': status,
				
				'action': 'activate_link'				

			};


		j.ajax({

				type: "POST",

				url: 'team_link.php',

				data: params,

				dataType: 'text',
				
				success: function(data){
				

						 	document.getElementById('link_list').innerHTML=data;				 
						//j('#DisplayLinkBlock').html(data);
					 
				}

		});

	
}


function delete_link_grp_team(team_group_id,team_id)

{


		if(confirm('Want To delete This Group?'))
		{
			var params ={

				'team_group_id': team_group_id,
				
				'team_id': team_id,
				
				'ajax': 'Y',
				
				'action': 'delete_link_grp'			

			};


		j.ajax({

				type: "POST",

				url: 'team_link.php',

				data: params,

				dataType: 'text',
				
				success: function(data){
				

						 	document.getElementById('link_list').innerHTML=data;				 
						//j('#DisplayLinkBlock').html(data);
					 
				}

		});
		}

	
}

function del_link_team(team_link_id,team_id,status)

{


		if(confirm('Want To delete?'))
		{
			var params ={

				'team_link_id': team_link_id,

				'team_id': team_id,
				
				'ajax': 'Y',	
				
				'status': status,
				
				'action': 'delete_link'			

			};


		j.ajax({

				type: "POST",

				url: 'team_link.php',

				data: params,

				dataType: 'text',
				
				success: function(data){
				

						 	document.getElementById('link_list').innerHTML=data;				 
						//j('#DisplayLinkBlock').html(data);
					 
				}

		});
		}
}


function change_type_team(team_link_id,team_id,team_link_open_type)

{



			var params ={

				'team_link_id': team_link_id,

				'team_id': team_id,
				
				'team_link_open_type': team_link_open_type,
				
				'ajax': 'Y',	
			
				
				'action': 'change_type'			

			};


		j.ajax({

				type: "POST",

				url: 'team_link.php',

				data: params,

				dataType: 'text',
				
				success: function(data){
				

						 	document.getElementById('link_list').innerHTML=data;				 
						//j('#DisplayLinkBlock').html(data);
					 
				}

		});

	
}

function create_link_team(team_group_id,team_id,div_id,link_count)

{



			var params ={

				'team_group_id': team_group_id,

				'team_id': team_id,
				
				'link_count': link_count,
				
				'action': 'change_type'		

			};


		j.ajax({

				type: "POST",

				url: 'create_team_link.php',

				data: params,

				dataType: 'text',
				
				success: function(data){
				

						 	document.getElementById(div_id).innerHTML=data;				 
						//j('#DisplayLinkBlock').html(data);
					 
				}

		});

	
}

function insert_link_team(team_group_id,team_id,link_count)

{
			params ={

				'team_group_id': team_group_id,

				'team_id': team_id,
				
				'link_count': link_count,
				
				
				'ajax': 'Y',	
				
				
				'action': 'insert_link'			

			};



		var frmID='#link_frm_'+team_group_id;

		var paramsObj = j(frmID).serializeArray();

			
			j.each(paramsObj, function(i, field){

				params[field.name] = field.value;

			});			



		j.ajax({

				type: "POST",

				url: 'team_link.php',

				data: params,

				dataType: 'text',
				
				success: function(data){
				

						 	document.getElementById('link_list').innerHTML=data;				 
						//j('#DisplayLinkBlock').html(data);
					 
				}

		});

	
}


function create_grp_link_team(team_id,link_count,grp_title)
{
			var params ={

				'team_id': team_id,
				
				'link_count': link_count,
				
				'grp_title': grp_title,
		
				'action': 'create_grp_link'		

			};


		j.ajax({

				type: "POST",

				url: 'create_team_grp_link.php',

				data: params,

				dataType: 'text',
				
				success: function(data){
				

						 	document.getElementById('new_link_grp_div').innerHTML=data;				 
						//j('#DisplayLinkBlock').html(data);
					 
				}

		});

	
}


function insert_grp_link_team(team_id,link_count,grp_title)

{

			
		if(grp_title!='')	
		{
			
			params ={

				'team_id': team_id,
				
				'link_count': link_count,
				
				'grp_title': grp_title,			
				
				'ajax': 'Y',	
				
				'action': 'insert_grp_link'				

			};



		var frmID='#grp_link_frm';

		var paramsObj = j(frmID).serializeArray();

			
			j.each(paramsObj, function(i, field){

				params[field.name] = field.value;

			});			



		j.ajax({

				type: "POST",

				url: 'team_link.php',

				data: params,

				dataType: 'text',
				
				success: function(data){
				

						 	document.getElementById('link_list').innerHTML=data;				 
						//j('#DisplayLinkBlock').html(data);
					 
				}

		});
		
		
		}

	
}

<!--  Team Ajax Function End  -->

<!--  cms Ajax Function Start  -->

function change_status_cms(cms_link_id,cms_id,status)

{
			var params ={

				'cms_link_id': cms_link_id,

				'cms_id': cms_id,
				
				'ajax': 'Y',	
				
				'status': status,
				
				'action': 'activate_link'				

			};


		j.ajax({

				type: "POST",

				url: 'cms_link.php',

				data: params,

				dataType: 'text',
				
				success: function(data){
				

						 	document.getElementById('link_list').innerHTML=data;				 
						//j('#DisplayLinkBlock').html(data);
					 
				}

		});

	
}

function delete_link_grp_cms(cms_group_id,cms_id)

{


		if(confirm('Want To delete This Group?'))
		{
			var params ={

				'cms_group_id': cms_group_id,
				
				'cms_id': cms_id,
				
				'ajax': 'Y',
				
				'action': 'delete_link_grp'			

			};


		j.ajax({

				type: "POST",

				url: 'cms_link.php',

				data: params,

				dataType: 'text',
				
				success: function(data){
				

						 	document.getElementById('link_list').innerHTML=data;				 
						//j('#DisplayLinkBlock').html(data);
					 
				}

		});
		}

	
}

function del_link_cms(cms_link_id,cms_id,status)

{


		if(confirm('Want To delete?'))
		{
			var params ={

				'cms_link_id': cms_link_id,

				'cms_id': cms_id,
				
				'ajax': 'Y',	
				
				'status': status,
				
				'action': 'delete_link'			

			};


		j.ajax({

				type: "POST",

				url: 'cms_link.php',

				data: params,

				dataType: 'text',
				
				success: function(data){
				

						 	document.getElementById('link_list').innerHTML=data;				 
						//j('#DisplayLinkBlock').html(data);
					 
				}

		});
		}

	
}

function change_type_cms(cms_link_id,cms_id,cms_link_open_type)
{



			var params ={

				'cms_link_id': cms_link_id,

				'cms_id': cms_id,
				
				'cms_link_open_type': cms_link_open_type,
				
				'ajax': 'Y',	
			
				
				'action': 'change_type'			

			};


		j.ajax({

				type: "POST",

				url: 'cms_link.php',

				data: params,

				dataType: 'text',
				
				success: function(data){
				

						 	document.getElementById('link_list').innerHTML=data;				 
						//j('#DisplayLinkBlock').html(data);
					 
				}

		});

	
}



function create_link_cms(cms_group_id,cms_id,div_id,link_count)

{



			var params ={

				'cms_group_id': cms_group_id,

				'cms_id': cms_id,
				
				'link_count': link_count,
				
				'action': 'change_type'		

			};


		j.ajax({

				type: "POST",

				url: 'create_cms_link.php',

				data: params,

				dataType: 'text',
				
				success: function(data){
				

						 	document.getElementById(div_id).innerHTML=data;				 
						//j('#DisplayLinkBlock').html(data);
					 
				}

		});

	
}


function insert_link_cms(cms_group_id,cms_id,link_count)

{
			params ={

				'cms_group_id': cms_group_id,

				'cms_id': cms_id,
				
				'link_count': link_count,
				
				
				'ajax': 'Y',	
				
				
				'action': 'insert_link'			

			};



		var frmID='#link_frm_'+cms_group_id;

		var paramsObj = j(frmID).serializeArray();

			
			j.each(paramsObj, function(i, field){

				params[field.name] = field.value;

			});			



		j.ajax({

				type: "POST",

				url: 'cms_link.php',

				data: params,

				dataType: 'text',
				
				success: function(data){
				

						 	document.getElementById('link_list').innerHTML=data;				 
						//j('#DisplayLinkBlock').html(data);
					 
				}

		});

	
}

function create_grp_link_cms(cms_id,link_count,grp_title)
{
			var params ={

				'cms_id': cms_id,
				
				'link_count': link_count,
				
				'grp_title': grp_title,
		
				'action': 'create_grp_link'		

			};


		j.ajax({

				type: "POST",

				url: 'create_cms_grp_link.php',

				data: params,

				dataType: 'text',
				
				success: function(data){
				

						 	document.getElementById('new_link_grp_div').innerHTML=data;				 
						//j('#DisplayLinkBlock').html(data);
					 
				}

		});

	
}

function insert_grp_link_cms(cms_id,link_count,grp_title)
{

			
		if(grp_title!='')	
		{
			
			params ={

				'cms_id': cms_id,
				
				'link_count': link_count,
				
				'grp_title': grp_title,			
				
				'ajax': 'Y',	
				
				'action': 'insert_grp_link'				

			};



		var frmID='#grp_link_frm';

		var paramsObj = j(frmID).serializeArray();

			
			j.each(paramsObj, function(i, field){

				params[field.name] = field.value;

			});			



		j.ajax({

				type: "POST",

				url: 'cms_link.php',

				data: params,

				dataType: 'text',
				
				success: function(data){
				

						 	document.getElementById('link_list').innerHTML=data;				 
						//j('#DisplayLinkBlock').html(data);
					 
				}

		});
		
		
		}

	
}

<!--  Team cms Function End  -->

<!-- end -->